package yf.mall.service;

import com.yf.entity.TokenEntity;
import com.yf.entity.WxUser;
import yf.mall.entity.UserEntity;
import com.yf.service.BaseService;
import yf.mall.vo.UserEntityVo;
import yf.mall.vo.UserVo;

import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.util.List;

/**
 * 用户Service接口
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Thu Jul 11 12:00:51 CST 2019
 */
public interface UserService extends BaseService<UserEntity> {

    List<UserVo> queryListVo(UserVo userVo);

    UserVo getVo(Long id);

    UserVo updateVo(UserVo userVo);

    UserEntity findByCode(String code);

    UserEntity findByMobile(String mobile);

    void validateUser(UserEntity fromUser,UserEntity toUser);

    List<UserVo> findByNameOrCodeOrMobile(String param);

//    List<UserEntity> findByTop(Long userId,Integer type);
    List<UserVo> findByTop(Long userId, Integer type);

    void validatePhone(String phone,UserEntity userEntity);

    //禁止状态用户不允许操作
    void validateUser(Long userId);

    /**
     * 找出级别比自己高的人
     * @param userId
     * @return
     */
    UserEntity getLvTopUser(Long userId);

    /**
     * api
     */

    //手机号跟验证码登录
    TokenEntity phoneLogin(String avatar,String name,String openId,String unionId,String phone,String captcha,Long topUserId,Boolean register);

    //微信登录 是否直接注册
    TokenEntity wxLogin(WxUser wxUser, Long topUserId, Boolean register);

    //注册
    UserEntity register(String openId,String unionId,String name,String avatar,String phone,String captcha,Long topUserId);
    //五集时代跳转社集优选注册
    UserEntity wgRegister(String unionId,String name,String code,String tCode,String avatar,String phone,Long topUserId,String topCode);
    //扫描公众号注册
    UserEntity register(String openId,Long topUserId);

    //用户编辑  绑定手机号 同步账号
    UserEntity update(Long userId,String phone,String password,String name,Boolean sync);

    //通过微信OpenId或者UnionID查找
    UserEntity findByWxId(String wxId);

    UserEntityVo findNowUserInfo(Long userId);

    //生成授权证书
    void createAuthImg(Long userId, HttpServletResponse response);

}
